<?php

/**
 * @author quang
 * @copyright 2010
 */

require_once("includes/functions/facebookinclude.php");
require_once("includes/functions/general.php");

    //echo 'image name '.$imageName.' ';
    $imageUrl = 'http://www.intelligentdailyblog.fr/vn/quizz2/images/bg.png';
    #post it
    $msg='';
    if($strLanguage=='en'){
        $msg = "You have ".$_SESSION["user"]->getScore()." points in this game ".FACEBOOK_APPNAME.".";
    }else{
        $msg = "Vous avez ".$_SESSION["user"]->getScore()." points pour ce jeu ".FACEBOOK_APPNAME.".";
    }
    $attachment = array('message'=>  $msg,
                  'name' => FACEBOOK_APPNAME,
                  'description' => FB_DESC,
                  'caption' => FB_CAPTION,  
                  'picture' => $imageUrl,  
                  'link' => FACEBOOK_CANVAS_URL
                    ); 
    $facebook->api('/'.$uid.'/feed','post',$attachment );    
   # echo "Posted success";
   tep_redirect(FACEBOOK_INVITE);
   
   /**
 * echo "
 *         <script type=\"text/javascript\">            
 *             var answer = confirm(\"Do you want to invite your friend?\");
 *             if(answer){
 *                 window.location= '".FACEBOOK_INVITE."';   
 *             }else{
 *                 top.location.href = '".FACEBOOK_HOME."';
 *             }
 *         </script>"; 
 */
?>